package com.boco.hsqldb.mapper;

import com.boco.hsqldb.entity.Alarm;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AlarmMapper {
    @Select(value = "select * from alarm limit 10")
    List<Alarm> query();

    @Select(value = "select count(1) from alarm")
    int queryAllSize();

    @Select(value = "select * from alarm where fp0 = #{fp0}")
    List<Alarm> queryByIndexFp0(@Param("fp0")Integer fp0);

    @Select(value = "select * from alarm where fp1 = #{fp1}")
    List<Alarm> queryByFp1(@Param("fp1")Integer fp1);

    @Insert(value = "insert into alarm(fp0,fp1,fp2,fp3,event_time) values(#{fp0},#{fp1},#{fp2},#{fp3},#{event_time})")
    void add(@Param("fp0")Integer fp0,@Param("fp1")Integer fp1,@Param("fp2")Integer fp2,@Param("fp3")Integer fp3,@Param("event_time")String event_time);

    @Select(value = "${sql}")
    List<Alarm> queryByCustomSql(@Param("sql") String sql);
}